import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;


public class WebExtra {

	//Setting the cookie expiration date
	final static int TIME_TYPE_TO_ADD = Calendar.WEEK_OF_MONTH;
	final static int AMOUNT_TO_ADD = 1;
	
	final static String[] MONTHS = {"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
	final static String[] DAYS = {"Sunday","Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"};
	private static String getCookieExpireString(Date date) {
		GregorianCalendar expires = new GregorianCalendar();
		expires.setTime(date);
		expires.setTimeZone(TimeZone.getTimeZone("GMT"));
		expires.add(TIME_TYPE_TO_ADD, AMOUNT_TO_ADD);
		return DAYS[expires.get(Calendar.DAY_OF_WEEK)-1] + "," + 
				expires.get(Calendar.DAY_OF_MONTH) + "-" +
				MONTHS[expires.get(Calendar.MONTH)-1] + "-" +
				expires.get(Calendar.YEAR) + " " + 
				expires.get(Calendar.HOUR_OF_DAY) + ":" + 
				expires.get(Calendar.MINUTE) + ":" +
				expires.get(Calendar.SECOND) + " GMT"; 
	}
	
}
